# Contributor: Corrado Primier <bardo@aur.archlinux.org>
# Contributor: danst0 <danst0@west.de>

# Build order: avr-binutils -> avr-gcc -> avr-libc

pkgname=avr-libc
pkgver=2.1.0
pkgrel=3
pkgdesc='The C runtime library for the AVR family of microcontrollers'
arch=(any)
url='https://savannah.nongnu.org/projects/avr-libc/'
license=(BSD)
depends=(avr-gcc)
options=(!strip) # it corrupts avr libraries
source=(https://download.savannah.gnu.org/releases/$pkgname/$pkgname-$pkgver.tar.bz2{,.sig})
b2sums=('b17f3c4971221abe78d4f1d749c6f093e6fcf77b3435bc280af6025bf1c263a4d4d71c55c285ab7d7b458b361baa1d8b928f3ff706510c22b8c6d9f594c44abc'
        'SKIP')
validpgpkeys=('56628323218C669FF578705C7E9EADC3030D34EB') # Joerg Wunsch

build() {
  cd avr-libc-$pkgver
  ./bootstrap
  ./configure --build=$(./config.guess) --host=avr --prefix=/usr
  make
}

package() {
  cd avr-libc-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
